package com.springboot.service;
import java.util.Date;

import com.springboot.entity.WmsUpc;
import com.springboot.mapper.WmsUpcMapper;
import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.springboot.entity.User;
import com.springboot.mapper.UserMapper;

/**
 * 大仓商品服务实现类
 */
@Service
public class UserService {

	@Autowired
	private UserMapper userMapper;

	@Autowired
	private WmsUpcMapper wmsUpcMapper;

	public String userTest() {
		String name1 = null;
		String name2 = null;
		List<User> list = new ArrayList<User>();
		list.add(new User(101, "wangsy101"));
		list.add(new User(102, "wangsy102"));
		//userMapper.updateUser(list);
		userMapper.updateBatch(list);
		//userMapper.findUserByCid(101);
		return name1 + ":" + name2;
	}

    public String userAddTest() {
        User user = new User();
        user.setcId(102);
        user.setName("102102102102");
        user.setChName("wangsycccsdsa102");
        user.setEmail("wangs102102cc@feiniu.com");
        user.setMobile("102102102102");
        user.setType(0);

        userMapper.insertSelective(user);
        User user1 = new User();
        user1.setcId(101);
        user1.setName("101101101101");
        user1.setChName("wangsycccsdsa101");
        user1.setEmail("wangsycccc@feiniu.com");
        user1.setMobile("101101101");
        user1.setType(0);
        userMapper.insertSelective(user1);
        return user.getId()+"-"+user.getId();
    }


    public String upcAddTest() {
        WmsUpc wmsUpc = new WmsUpc();
        wmsUpc.setDcId(101);
        wmsUpc.setGoodsCode("101");
        wmsUpc.setUpcType(false);
        wmsUpc.setUpc("101");
        wmsUpc.setDelFlg(false);
        wmsUpc.setCreateId("101");
        wmsUpc.setCreateTime(new Date());
        wmsUpc.setModUsrType(false);
        wmsUpc.setUpdateId("101");
        wmsUpc.setUpdateTime(new Date());
        wmsUpc.setcId(101);
        wmsUpcMapper.insertSelective(wmsUpc);
        WmsUpc wmsUpc1 = new WmsUpc();
        wmsUpc1.setDcId(102);
        wmsUpc1.setGoodsCode("102");
        wmsUpc1.setUpcType(false);
        wmsUpc1.setUpc("102");
        wmsUpc1.setDelFlg(false);
        wmsUpc1.setCreateId("102");
        wmsUpc1.setCreateTime(new Date());
        wmsUpc1.setModUsrType(false);
        wmsUpc1.setUpdateId("102");
        wmsUpc1.setUpdateTime(new Date());
        wmsUpc1.setcId(102);
        wmsUpcMapper.insertSelective(wmsUpc1);

        return wmsUpc.getId()+"-"+wmsUpc1.getId();
    }


}
